home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Sample Code / MoreFiles 1.2.1 / MoreFilesExtras.p < prev    next >
Encoding:
Text File  |  1994-08-09  |  55.3 KB  |  1,418 lines  |  [TEXT/PJMM]

  1. UNIT MoreFilesExtras;
  2.  
  3. {    Apple Macintosh Developer Technical Support                                }
  4. {                                                                            }
  5. {    A collection of useful high-level File Manager routines.                }
  6. {    by Jim Luther, Apple Developer Technical Support                        }
  7. {                                                                            }
  8. {    File:        MoreFilesExtras.p                                            }
  9. {                                                                            }
  10. {    Copyright © 1992-1994 Apple Computer, Inc.                                }
  11. {    All rights reserved.                                                    }
  12. {                                                                            }
  13. {    You may incorporate this sample code into your applications without        }
  14. {    restriction, though the sample code has been provided "AS IS" and the    }
  15. {    responsibility for its operation is 100% yours.  However, what you are    }
  16. {    not permitted to do is to redistribute the source as "DSC Sample Code"    }
  17. {    after having made changes. If you're going to re-distribute the source,    }
  18. {    we require that you make it clear in the source that the code was        }
  19. {    descended from Apple Sample Code, but that you've made changes.            }
  20.  
  21.  
  22. INTERFACE
  23.  
  24. {    Deny mode permissions for use with the HOpenAware, HOpenRFAware,        }
  25. {    FSpOpenAware, and FSpOpenRFAware functions.                                }
  26.  
  27.     CONST
  28.         dmNone = $0000;
  29.         dmNoneDenyRd = $0010;
  30.         dmNoneDenyWr = $0020;
  31.         dmNoneDenyRdWr = $0030;
  32.         dmRd = $0001;            { Single writer, multiple readers; the readers }
  33.         dmRdDenyRd = $0011;
  34.         dmRdDenyWr = $0021;        { Browsing - equivalent to fsRdPerm }
  35.         dmRdDenyRdWr = $0031;
  36.         dmWr = $0002;
  37.         dmWrDenyRd = $0012;
  38.         dmWrDenyWr = $0022;
  39.         dmWrDenyRdWr = $0032;
  40.         dmRdWr = $0003;            { Shared access - equivalent to fsRdWrShPerm }
  41.         dmRdWrDenyRd = $0013;
  42.         dmRdWrDenyWr = $0023;    { Single writer, multiple readers; the writer }
  43.         dmRdWrDenyRdWr = $0033;    { Exclusive access - equivalent to fsRdWrPerm }
  44.  
  45.  
  46. {    For those times where you need to use more than one kind of                }
  47. {    File Manager parameter block but don't feel like wasting stack space,    }
  48. {    here's a parameter block you can reuse.                                    }
  49.  
  50.     TYPE
  51.         UniversalFMPBHandle = ^UniversalFMPBPtr;
  52.         UniversalFMPBPtr = ^UniversalFMPB;
  53.         UniversalFMPB = RECORD
  54.                 CASE Integer OF
  55.                     1: (
  56.                             PB: ParamBlockRec
  57.                     );
  58.                     2: (
  59.                             ciPB: CInfoPBRec
  60.                     );
  61.                     3: (
  62.                             dtPB: DTPBRec
  63.                     );
  64.                     4: (
  65.                             hPB: HParamBlockRec
  66.                     );
  67.                     5: (
  68.                             cmPB: CMovePBRec
  69.                     );
  70.                     6: (
  71.                             wdPB: WDPBRec
  72.                     );
  73.                     7: (
  74.                             fcbPB: FCBPBRec
  75.                     );
  76.             END;
  77.  
  78.  
  79. {    Used by GetUGEntries to return user or group lists.                        }
  80.  
  81.         UGEntryHandle = ^UGEntryPtr;
  82.         UGEntryPtr = ^UGEntry;
  83.         UGEntry = RECORD
  84.                 objType: Integer;
  85.                 objID: LongInt;
  86.                 name: Str31;
  87.             END;
  88.  
  89.  
  90. {    I use the following record instead of the AFPVolMountInfo structure        }
  91. {    in Files.p                                                                }
  92.  
  93.         Str8 = STRING[8];
  94.         MyAFPVolMountInfoHandle = ^MyAFPVolMountInfoPtr;
  95.         MyAFPVolMountInfoPtr = ^MyAFPVolMountInfo;
  96.         MyAFPVolMountInfo = RECORD
  97.                 length: Integer;                { length of this record }
  98.                 media: VolumeType;                { type of media, always AppleShareMediaType }
  99.                 flags: Integer;                    { 0 = normal mount; set bit 0 to inhibit greeting messages }
  100.                 nbpInterval: SignedByte;        { NBP interval parameter; 7 is a good choice }
  101.                 nbpCount: SignedByte;            { NBP count parameter; 5 is a good choice }
  102.                 uamType: Integer;                { User Authentication Method }
  103.                 zoneNameOffset: Integer;        { offset from start of record to zoneName }
  104.                 serverNameOffset: Integer;        { offset from start of record to serverName }
  105.                 volNameOffset: Integer;            { offset from start of record to volName }
  106.                 userNameOffset: Integer;        { offset from start of record to userName }
  107.                 userPasswordOffset: Integer;    { offset from start of record to userPassword }
  108.                 volPasswordOffset: Integer;        { offset from start of record to volPassword }
  109.                 zoneName: Str31;                { server's AppleTalk zone name }
  110.                 serverName: Str31;                { server name }
  111.                 volName: Str27;                    { volume name }
  112.                 userName: Str31;                { user name (zero length Pascal string for guest) }
  113.                 userPassword: Str8;                { user password (zero length Pascal string if no user password) }
  114.                 volPassword: Str8;                { volume password (zero length Pascal string if no volume password) }
  115.             END;
  116.  
  117.  
  118. {***************************************************************************}
  119.  
  120. {    Functions to get information out of GetVolParmsInfoBuffer (implemented    }
  121. {    in this Unit).                                                            }
  122.  
  123.     FUNCTION isNetworkVolume (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  124.     FUNCTION hasLimitFCBs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  125.     FUNCTION hasLocalWList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  126.     FUNCTION hasNoMiniFndr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  127.     FUNCTION hasNoVNEdit (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  128.     FUNCTION hasNoLclSync (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  129.     FUNCTION hasTrshOffLine (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  130.     FUNCTION hasNoSwitchTo (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  131.     FUNCTION hasNoDeskItems (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  132.     FUNCTION hasNoBootBlks (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  133.     FUNCTION hasAccessCntl (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  134.     FUNCTION hasNoSysDir (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  135.     FUNCTION hasExtFSVol (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  136.     FUNCTION hasOpenDeny (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  137.     FUNCTION hasCopyFile (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  138.     FUNCTION hasMoveRename (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  139.     FUNCTION hasDesktopMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  140.     FUNCTION hasShortName (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  141.     FUNCTION hasFolderLock (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  142.     FUNCTION hasPersonalAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  143.     FUNCTION hasUserGroupList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  144.     FUNCTION hasCatSearch (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  145.     FUNCTION hasFileIDs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  146.     FUNCTION hasBTreeMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  147.     FUNCTION hasBlankAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  148.  
  149.  
  150. {***************************************************************************}
  151.  
  152.  
  153.     FUNCTION NameFileSearch (volName: StringPtr;
  154.                                     vRefNum: Integer;
  155.                                     fileName: Str255;
  156.                                     matches: FSSpecPtr;
  157.                                     reqMatchCount: LongInt;
  158.                                     VAR actMatchCount: LongInt;
  159.                                     newSearch: Boolean;
  160.                                     partial: Boolean): OSErr;
  161. {    Use NameFileSearch to search for files with a specific file name on a    }
  162. {    volume that supports PBCatSearch.                                        }
  163. {    Note: A result of catChangedErr means the catalog has changed between    }
  164. {    searches, but the search can be continued with the possiblity that you    }
  165. {    may miss some matches or get duplicate matches.  For all other results    }
  166. {    (except for noErr), the search cannot be continued.                        }
  167. {                                                                            }
  168. {    volName            input:    A pointer to the name of a mounted volume        }
  169. {                            or nil.                                            }
  170. {    vRefNum            input:    Volume specification.                            }
  171. {    fileName        input:    The name of the file to search for.                }
  172. {    matches            input:    Pointer to array of FSSpec where the match list    }
  173. {                            is returned.                                    }
  174. {    reqMatchCount    input:    Maximum number of matches to return    (the number    }
  175. {                            of elements in the matches array).                }
  176. {    actMatchCount    output: The number of matches actually returned.        }
  177. {    newSearch        input:    If true, start a new search. If false and if    }
  178. {                            vRefNum is the same as the last call to            }
  179. {                            NameFileSearch, then start searching at the        }
  180. {                            position where the last search left off.        }
  181. {    partial            input:    If the partial parameter is false, then only    }
  182. {                            files that exactly match fileName will be        }
  183. {                            found.  If the partial parameter is true, then    }
  184. {                            all file names that contain fileName will be    }
  185. {                            found.                                            }
  186.  
  187.  
  188. {***************************************************************************}
  189.  
  190.  
  191.     FUNCTION CreatorTypeFileSearch (volName: StringPtr;
  192.                                     vRefNum: Integer;
  193.                                     creator: OSType;
  194.                                     fileType: OSType;
  195.                                     matches: FSSpecPtr;
  196.                                     reqMatchCount: LongInt;
  197.                                     VAR actMatchCount: LongInt;
  198.                                     newSearch: Boolean): OSErr;
  199. {    Use CreatorTypeFileSearch to search for files with a specific creator    }
  200. {    or fileType on a volume that supports PBCatSearch.                        }
  201. {    Note: A result of catChangedErr means the catalog has changed between    }
  202. {    searches, but the search can be continued with the possiblity that you    }
  203. {    may miss some matches or get duplicate matches.  For all other results    }
  204. {    (except for noErr), the search cannot be continued.                        }
  205. {                                                                            }
  206. {    volName            input:    A pointer to the name of a mounted volume        }
  207. {                            or nil.                                            }
  208. {    vRefNum            input:    Volume specification.                            }
  209. {    creator            input:    The creator type of the file to search for.        }
  210. {                            To ignore the creator type, pass 0x00000000 in    }
  211. {                            this field.                                        }
  212. {    fileType        input:    The file type of the file to search for.        }
  213. {                            To ignore the file type, pass 0x00000000 in        }
  214. {                            this field.                                        }
  215. {    matches            input:    Pointer to array of FSSpec where the match list    }
  216. {                            is returned.                                    }
  217. {    reqMatchCount    input:    Maximum number of matches to return    (the number    }
  218. {                            of elements in the matches array).                }
  219. {    actMatchCount    output: The number of matches actually returned.        }
  220. {    newSearch        input:    If true, start a new search. If false and if    }
  221. {                            vRefNum is the same as the last call to            }
  222. {                            CreatorTypeFileSearch, then start searching at    }
  223. {                            the position where the last search left off.    }
  224.  
  225.  
  226. {***************************************************************************}
  227.  
  228.  
  229.     FUNCTION DetermineVRefNum (pathname: StringPtr;
  230.                                     vRefNum: Integer;
  231.                                     VAR realVRefNum: Integer): OSErr;
  232. {    Use DetermineVRefNum to determine the volume reference number of a        }
  233. {    volume from a pathname, a volume specification, or a combination        }
  234. {    of the two.                                                                }
  235. {    WARNING: Volume names on the Macintosh are *not* unique -- Multiple        }
  236. {    mounted volumes can have the same name. For this reason, the use of a    }
  237. {    volume name or full pathname to identify a specific volume may not        }
  238. {    produce the results you expect.  If more than one volume has the same    }
  239. {    name and a volume name or full pathname is used, the File Manager        }
  240. {    currently uses the first volume it finds with a matching name in the    }
  241. {    volume queue.                                                            }
  242. {                                                                            }
  243. {    pathName    input:    Pointer to a full pathname or nil.  If you pass in    }
  244. {                        a partial pathname, it is ignored. A full pathname    }
  245. {                        to a volume must end with a colon character (:).    }
  246. {    vRefNum        input:    Volume specification (volume reference number,        }
  247. {                        working    directory number, drive number, or 0).        }
  248. {    realVRefNum    output:    The real volume reference number.                    }
  249.  
  250.  
  251. {***************************************************************************}
  252.  
  253.  
  254.     FUNCTION HGetVInfo (volReference: Integer;
  255.                                     volName: StringPtr;
  256.                                     VAR vRefNum: Integer;
  257.                                     VAR freeBytes: LongInt;
  258.                                     VAR totalBytes: LongInt): OSErr;
  259. {    The HGetVInfo function returns the name, volume reference number,        }
  260. {    available space (in bytes), and total space (in bytes) for the            }
  261. {    specified volume. You can specify the volume by providing its drive        }
  262. {    number, volume reference number, or 0 for the default volume.            }
  263. {    This routine is compatible with volumes up to 4 gigabytes.                }
  264. {                                                                            }
  265. {    volReference    input:    The drive number, volume reference number,        }
  266. {                            or 0 for the default volume.                    }
  267. {    volName            input:    A pointer to a buffer (minimum Str27) where        }
  268. {                            the volume name is to be returned or must        }
  269. {                            be nil.                                            }
  270. {                    output:    The volume name.                                }
  271. {    vRefNum            output:    The volume reference number.                    }
  272. {    freeBytes        output:    The number of free bytes on the volume.            }
  273. {                            freeBytes is an UNSIGNED long value.            }
  274. {    totalBytes        output:    The total number of bytes on the volume.        }
  275. {                            totalBytes is an UNSIGNED long value.            }
  276.  
  277.  
  278. {***************************************************************************}
  279.  
  280.  
  281.     FUNCTION CheckVolLock (pathname: StringPtr;
  282.                                     vRefNum: Integer): OSErr;
  283. {    Use CheckVolLock to determine if a volume is locked - either by         }
  284. {    hardware or by software. If CheckVolLock returns noErr, then the volume    }
  285. {    is not locked.                                                            }
  286. {                                                                            }
  287. {    pathName    input:    Pointer to a full pathname or nil.  If you pass in    }
  288. {                        a partial pathname, it is ignored. A full pathname    }
  289. {                        to a volume must end with a colon character (:).    }
  290. {    vRefNum        input:    Volume specification (volume reference number,        }
  291. {                        working    directory number, drive number, or 0).        }
  292.  
  293.  
  294. {***************************************************************************}
  295.  
  296.  
  297.     FUNCTION UnmountAndEject (pathname: StringPtr;
  298.                                     vRefNum: Integer): OSErr;
  299. {    Use UnmountAndEject to unmount and eject a volume. The volume is        }
  300. {    ejected only if it's ejectable and not already ejected.                    }
  301. {                                                                            }
  302. {    pathName    input:    Pointer to a full pathname or nil.  If you pass in  }
  303. {                        a partial pathname, it is ignored. A full pathname    }
  304. {                        to a volume must end with a colon character (:).    }
  305. {    vRefNum        input:    Volume specification (volume reference number,        }
  306. {                        workingdirectory number, drive number, or 0).        }
  307.  
  308.  
  309. {***************************************************************************}
  310.  
  311.  
  312.     FUNCTION OnLine (volumes: FSSpecPtr;
  313.                                     reqVolCount: Integer;
  314.                                     VAR actVolCount: Integer;
  315.                                     VAR volIndex: Integer): OSErr;
  316. {    Use OnLine to return the list of volumes currently mounted.                }
  317. {                                                                            }
  318. {    volumes        input:    Pointer to array of FSSpec where the volume list    }
  319. {                        is returned.                                        }
  320. {    reqVolCount    input:    Maximum number of volumes to return    (the number of    }
  321. {                        elements in the volumes array).                        }
  322. {    actVolCount    output: The number of volumes actually returned.            }
  323. {    volIndex    input:    The current volume index position. Set to 1 to        }
  324. {                        start with the first volume.                        }
  325. {                output:    The volume index position to get the next volume.    }
  326. {                        Pass this value the next time you call OnLine to    }
  327. {                        start where you left off.                            }
  328.  
  329.  
  330. {***************************************************************************}
  331.  
  332.  
  333.     FUNCTION GetDInfo (vRefNum: Integer;
  334.                                     dirID: LongInt;
  335.                                     name: StringPtr;
  336.                                     VAR fndrInfo: DInfo): OSErr;
  337. {    Use GetDInfo to get the finder information for a directory.                }
  338. {                                                                            }
  339. {    vRefNum            input:    Volume specification.                            }
  340. {    dirID            input:    Directory ID.                                    }
  341. {    name            input:    Pointer to object name, or nil when dirID        }
  342. {                            specifies a directory that's the object.        }
  343. {    fndrInfo        output:    If the object is a directory, then its DInfo.    }
  344.  
  345.  
  346. {***************************************************************************}
  347.  
  348.  
  349.     FUNCTION FSpGetDInfo (spec: FSSpec;
  350.                                     VAR fndrInfo: DInfo): OSErr;
  351. {    Use FSpGetDInfo to get the finder information for a directory.            }
  352. {                                                                            }
  353. {    spec        input:    An FSSpec record specifying the directory.            }
  354. {    fndrInfo        output:    If the object is a directory, then its DInfo.    }
  355.  
  356.  
  357. {***************************************************************************}
  358.  
  359.  
  360.     FUNCTION GetDirID (vRefNum: Integer;
  361.                                     dirID: LongInt;
  362.                                     name: StringPtr;
  363.                                     VAR theDirID: LongInt;
  364.                                     VAR isDirectory: Boolean): OSErr;
  365. {    Use GetDirID to get the directory ID number of the directory            }
  366. {    specified.  If a file is specified, then the parent                        }
  367. {    directory of the file is returned and isDirectory is false.  If            }
  368. {    a directory is specified, then that directory's ID number is            }
  369. {    returned and isDirectory is true.                                        }
  370. {    WARNING: Volume names on the Macintosh are *not* unique -- Multiple        }
  371. {    mounted volumes can have the same name. For this reason, the use of a    }
  372. {    volume name or full pathname to identify a specific volume may not        }
  373. {    produce the results you expect.  If more than one volume has the same    }
  374. {    name and a volume name or full pathname is used, the File Manager        }
  375. {    currently uses the first volume it finds with a matching name in the    }
  376. {    volume queue.                                                            }
  377. {                                                                            }
  378. {    vRefNum            input:    Volume specification.                            }
  379. {    dirID            input:    Directory ID.                                    }
  380. {    name            input:    Pointer to object name, or nil when dirID        }
  381. {                            specifies a directory that's the object.        }
  382. {    theDirID        output:    If the object is a file, then its parent        }
  383. {                            directory ID. If the object is a directory,        }
  384. {                            then its ID.                                    }
  385. {    isDirectory        output:    True if object is a directory; false if            }
  386. {                            object is a file.                                }
  387.  
  388.  
  389. {***************************************************************************}
  390.  
  391.  
  392.     FUNCTION DirIDFromFSSpec (spec: FSSpec;
  393.                                     VAR dirID: LongInt;
  394.                                     VAR isDirectory: Boolean): OSErr;
  395. {    Use DirIDFromFSSpec to get the directory ID number of the directory        }
  396. {    specified by spec. If spec is to a file, then the parent                }
  397. {    directory of the file is returned and isDirectory is false.  If            }
  398. {    spec is to a directory, then that directory's ID number is                }
  399. {    returned and isDirectory is true.                                        }
  400. {                                                                            }
  401. {    spec            input:    An FSSpec record specifying the directory.        }
  402. {    theDirID        output:    The directory ID.                                }
  403. {    isDirectory        output:    True if object is a directory; false if            }
  404. {                            object is a file.                                }
  405.  
  406.  
  407. {***************************************************************************}
  408.  
  409.  
  410.     FUNCTION GetDirName (vRefNum: Integer;
  411.                                     dirID: LongInt;
  412.                                     name: StringPtr): OSErr;
  413. {    Use GetDirName to get the name of a directory from its directory ID.    }
  414. {                                                                            }
  415. {    vRefNum        input:    Volume specification.                                }
  416. {    dirID        input:    Directory ID.                                        }
  417. {    name        output:    Points to a buffer (minimum Str63) where the        }
  418. {                        directory name is to be returned or must be nil.    }
  419.  
  420.  
  421. {***************************************************************************}
  422.  
  423.  
  424.     FUNCTION GetParentID (vRefNum: Integer;
  425.                                     dirID: LongInt;
  426.                                     name: StringPtr;
  427.                                     VAR parID: LongInt): OSErr;
  428. {    Use GetParentID to get the parent directory ID number of the specified    }
  429. {    object.                                                                    }
  430. {                                                                            }
  431. {    vRefNum        input:    Volume specification.                                }
  432. {    dirID        input:    Directory ID.                                        }
  433. {    name        input:    Pointer to object name, or nil when dirID specifies    }
  434. {                        a directory that's the object.                        }
  435. {    parID        output:    The parent directory ID of the specified object.    }
  436.  
  437.  
  438. {***************************************************************************}
  439.  
  440.  
  441.     FUNCTION GetFilenameFromPathname (pathname: Str255;
  442.                                     VAR filename: Str255): OSErr;
  443. {    Use GetFilenameFromPathname to get the file (or directory) name from    }
  444. {    the end of a full or partial pathname. Returns notAFileErr if the        }
  445. {    pathname is nil, the pathname is empty, or the pathname cannot refer to    }
  446. {    a filename (with a noErr result, the pathname could still refer to a    }
  447. {    directory). GetFilenameFromPathname is used by GetObjectLocation.        }
  448. {                                                                            }
  449. {    pathname    input:    A full or partial pathname.                            }
  450. {    filename    output:    The file (or directory) name.                        }
  451.  
  452.  
  453. {***************************************************************************}
  454.  
  455.  
  456.     FUNCTION GetObjectLocation (vRefNum: Integer;
  457.                                     dirID: LongInt;
  458.                                     pathname: StringPtr;
  459.                                     VAR realVRefNum: Integer;
  460.                                     VAR realParID: LongInt;
  461.                                     VAR realName: Str255;
  462.                                     VAR isDirectory: Boolean): OSErr;
  463. {    Use GetObjectLocation to get a file system object's location - that is,    }
  464. {    its real volume reference number, real parent directory ID, and name.    }
  465. {    While we're at it, determine if the object is a file or directory.        }
  466. {    If GetObjectLocation returns fnfErr, then the location information        }
  467. {    returned is valid, but it describes an object that doesn't exist.        }
  468. {    You can use the location information for another operation, such as        }
  469. {    creating a file or directory.                                            }
  470. {                                                                            }
  471. {    vRefNum        input:    Volume specification.                                }
  472. {    dirID        input:    Directory ID.                                        }
  473. {    pathname    input:    Pointer to object name, or nil when dirID specifies    }
  474. {                        a directory that's the object.                        }
  475. {    realVRefNum    output:    The real volume reference number.                    }
  476. {    realParID    output:    The parent directory ID of the specified object.    }
  477. {    realName    output:    The name of the specified object (the case of the    }
  478. {                        object name may not be the same as the object's        }
  479. {                        catalog entry on disk - since the Macintosh file    }
  480. {                        system is not case sensitive, it shouldn't matter).    }
  481. {    isDirectory    output:    True if object is a directory; false if object        }
  482. {                        is a file.                                            }
  483.  
  484.  
  485. {***************************************************************************}
  486.  
  487.  
  488.     FUNCTION GetDirItems (vRefNum: Integer;
  489.                                     dirID: LongInt;
  490.                                     name: StringPtr;
  491.                                     getFiles: Boolean;
  492.                                     getDirectories: Boolean;
  493.                                     items: FSSpecPtr;
  494.                                     reqItemCount: Integer;
  495.                                     VAR actItemCount: Integer;
  496.                                     VAR itemIndex: Integer): OSErr;
  497. {    Use GetDirItems to return a list of items in a directory.                }
  498. {                                                                            }
  499. {    vRefNum            input:    Volume specification.                            }
  500. {    dirID            input:    Directory ID.                                    }
  501. {    name            input:    Pointer to object name, or nil when dirID        }
  502. {                            specifies a directory that's the object.        }
  503. {    getFiles        input:    Pass true to have files added to the items list.}
  504. {    getDirectories    input:    Pass true to have directories added to the        }
  505. {                            items list.                                        }
  506. {    items            input:    Pointer to array of FSSpec where the item list    }
  507. {                            is returned.                                    }
  508. {    reqItemCount    input:    Maximum number of items to return (the number    }
  509. {                            of elements in the items array).                }
  510. {    actItemCount    output: The number of volumes actually returned.        }
  511. {    itemIndex        input:    The current item index position. Set to 1 to    }
  512. {                            start with the first item in the directory.        }
  513. {                    output:    The item index position to get the next item.    }
  514. {                            Pass this value the next time you call            }
  515. {                            GetDirItems to start where you left off.        }
  516.  
  517.  
  518. {***************************************************************************}
  519.  
  520.  
  521.     FUNCTION DeleteDirectoryContents (vRefNum: Integer;
  522.                                     dirID: LongInt;
  523.                                     name: StringPtr): OSErr;
  524. {    The DeleteDirectoryContents function deletes the contents of a            }
  525. {    directory. All files and subdirectories in the specified directory are    }
  526. {    deleted. If a locked file or directory is encountered, it is unlocked    }
  527. {    and then deleted.  If any unexpected errors are encountered,            }
  528. {    DeleteDirectoryContents quits and returns to the caller.                }
  529. {                                                                            }
  530. {    vRefNum    input:    Volume specification.                                    }
  531. {    dirID    input:    Directory ID.                                            }
  532. {    name    input:    Pointer to directory name, or nil when dirID specifies    }
  533. {                    a directory that's the object.                            }
  534.  
  535.  
  536. {***************************************************************************}
  537.  
  538.  
  539.     FUNCTION DeleteDirectory (vRefNum: Integer;
  540.                                     dirID: LongInt;
  541.                                     name: StringPtr): OSErr;
  542. {    The DeleteDirectory function deletes a directory and its contents.        }
  543. {    All files and subdirectories in the specified directory are deleted.    }
  544. {    If a locked file or directory is encountered, it is unlocked and then    }
  545. {    deleted.  After deleting the directories contents, the directory is        }
  546. {    deleted. If any unexpected errors are encountered, DeleteDirectory        }
  547. {    quits and returns to the caller.                                        }
  548. {                                                                            }
  549. {    vRefNum    input:    Volume specification.                                    }
  550. {    dirID    input:    Directory ID.                                            }
  551. {    name    input:    Pointer to directory name, or nil when dirID specifies    }
  552. {                    a directory that's the object.                            }
  553.  
  554.  
  555. {***************************************************************************}
  556.  
  557.  
  558.     FUNCTION CheckObjectLock (vRefNum: Integer;
  559.                                     dirID: LongInt;
  560.                                     name: StringPtr): OSErr;
  561. {    Use CheckObjectLock to determine if a file or directory is locked.        }
  562. {    If CheckObjectLock returns noErr, then the file or directory            }
  563. {    is not locked.                                                            }
  564. {                                                                            }
  565. {    vRefNum    input:    Volume specification.                                    }
  566. {    dirID    input:    Directory ID.                                            }
  567. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  568. {                    a directory that's the object.                            }
  569.  
  570.  
  571. {***************************************************************************}
  572.  
  573.     FUNCTION FSpCheckObjectLock (spec: FSSpec): OSErr;
  574. {    Use FSpCheckObjectLock to determine if a file or directory is locked.    }
  575. {    If FSpCheckObjectLock returns noErr, then the file or directory            }
  576. {    is not locked.                                                            }
  577. {                                                                            }
  578. {    spec    input:    An FSSpec record specifying the object.                    }
  579.  
  580.  
  581. {***************************************************************************}
  582.  
  583.  
  584.     FUNCTION BumpDate (vRefNum: Integer;
  585.                                     dirID: LongInt;
  586.                                     name: StringPtr): OSErr;
  587. {    Use BumpDate to change the modification date of a file or directory to    }
  588. {    the current date/time.  If the modification date is already equal to    }
  589. {    the current date/time, then add one second to the modification date.    }
  590. {                                                                            }
  591. {    vRefNum    input:    Volume specification.                                    }
  592. {    dirID    input:    Directory ID.                                            }
  593. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  594. {                    a directory that's the object.                            }
  595.  
  596.  
  597. {***************************************************************************}
  598.  
  599.     FUNCTION FSpBumpDate (spec: FSSpec): OSErr;
  600. {    Use FSpBumpDate to change the modification date of a file or directory    }
  601. {    to the current date/time.  If the modification date is already equal    }
  602. {    to the current date/time, then add one second to the modification date.    }
  603. {                                                                            }
  604. {    spec    input:    An FSSpec record specifying the object.                    }
  605.  
  606.  
  607. {***************************************************************************}
  608.  
  609.  
  610.     FUNCTION ChangeCreatorType (vRefNum: Integer;
  611.                                     dirID: LongInt;
  612.                                     name: Str255;
  613.                                     creator: OSType;
  614.                                     fileType: OSType): OSErr;
  615. {    Use ChangeCreatorType to change the creator or file type of a file.        }
  616. {                                                                            }
  617. {    vRefNum        input:    Volume specification.                                }
  618. {    dirID        input:    Directory ID.                                        }
  619. {    name        input:    The name of the file.                                }
  620. {    creator        input:    The new creator type or 0x00000000 to leave            }
  621. {                        the creator type alone.                                }
  622. {    fileType    input:    The new file type or 0x00000000 to leave the        }
  623. {                        file type alone.                                    }
  624.  
  625.  
  626. {***************************************************************************}
  627.  
  628.  
  629.     FUNCTION FSpChangeCreatorType (spec: FSSpec;
  630.                                     creator: OSType;
  631.                                     fileType: OSType): OSErr;
  632. {    Use FSpChangeCreatorType to change the creator or file type of a file.    }
  633. {                                                                            }
  634. {    spec        input:    An FSSpec record specifying the file.                }
  635. {    creator        input:    The new creator type or 0x00000000 to leave            }
  636. {                        the creator type alone.                                }
  637. {    fileType    input:    The new file type or 0x00000000 to leave the        }
  638. {                        file type alone.                                    }
  639.  
  640.  
  641. {***************************************************************************}
  642.  
  643.  
  644.     FUNCTION ChangeFDFlags (vRefNum: Integer;
  645.                                     dirID: LongInt;
  646.                                     name: StringPtr;
  647.                                     setBits: Boolean;
  648.                                     flagBits: Integer): OSErr;
  649. {    Use ChangeFDFlags to set or clear Finder Flag bits in the fdFlags field    }
  650. {    of a file or directory's FInfo record.                                    }
  651. {                                                                            }
  652. {    vRefNum        input:    Volume specification.                                }
  653. {    dirID        input:    Directory ID.                                        }
  654. {    name        input:    Pointer to object name, or nil when dirID specifies    }
  655. {                        a directory that's the object.                        }
  656. {    setBits        input:    If true, then set the bits specified in flagBits.    }
  657. {                        If false, then clear the bits specified in flagBits.}
  658. {    flagBits    input:    The flagBits parameter specifies which Finder Flag    }
  659. {                        bits to set or clear. If a bit in flagBits is set,    }
  660. {                        then the same bit in fdFlags is either set or        }
  661. {                        cleared depending on the state of the setBits        }
  662. {                        parameter.                                            }
  663.  
  664.  
  665. {***************************************************************************}
  666.  
  667.  
  668.     FUNCTION FSpChangeFDFlags (spec: FSSpec;
  669.                                     setBits: Boolean;
  670.                                     flagBits: Integer): OSErr;
  671. {    Use FSpChangeFDFlags to set or clear Finder Flag bits in the fdFlags    }
  672. {    field of a file or directory's FInfo record.                            }
  673. {                                                                            }
  674. {    spec        input:    An FSSpec record specifying the object.                }
  675. {    setBits        input:    If true, then set the bits specified in flagBits.    }
  676. {                        If false, then clear the bits specified in flagBits.}
  677. {    flagBits    input:    The flagBits parameter specifies which Finder Flag    }
  678. {                        bits to set or clear. If a bit in flagBits is set,    }
  679. {                        then the same bit in fdFlags is either set or        }
  680. {                        cleared depending on the state of the setBits        }
  681. {                        parameter.                                            }
  682.  
  683.  
  684. {***************************************************************************}
  685.  
  686.  
  687.     FUNCTION SetIsInvisible (vRefNum: Integer;
  688.                                     dirID: LongInt;
  689.                                     name: StringPtr): OSErr;
  690. {    Use SetIsInvisible to set the invisible bit in the fdFlags word of the    }
  691. {    specified file or directory's finder information.                        }
  692. {                                                                            }
  693. {    vRefNum    input:    Volume specification.                                    }
  694. {    dirID    input:    Directory ID.                                            }
  695. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  696. {                    a directory that's the object.                            }
  697.  
  698.  
  699. {***************************************************************************}
  700.  
  701.  
  702.     FUNCTION FSpSetIsInvisible (spec: FSSpec): OSErr;
  703. {    Use FSpSetIsInvisible to set the invisible bit in the fdFlags word of    }
  704. {    the specified file or directory's finder information.                    }
  705. {                                                                            }
  706. {    spec    input:    An FSSpec record specifying the object.                    }
  707.  
  708.  
  709. {***************************************************************************}
  710.  
  711.  
  712.     FUNCTION ClearIsInvisible (vRefNum: Integer;
  713.                                     dirID: LongInt;
  714.                                     name: StringPtr): OSErr;
  715. {    Use ClearIsInvisible to clear the invisible bit in the fdFlags word of    }
  716. {    the specified file or directory's finder information.                    }
  717. {                                                                            }
  718. {    vRefNum    input:    Volume specification.                                    }
  719. {    dirID    input:    Directory ID.                                            }
  720. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  721. {                    a directory that's the object.                            }
  722.  
  723.  
  724. {***************************************************************************}
  725.  
  726.  
  727.     FUNCTION FSpClearIsInvisible (spec: FSSpec): OSErr;
  728. {    Use FSpClearIsInvisible to clear the invisible bit in the fdFlags word    }
  729. {    of the specified file or directory's finder information.                }
  730. {                                                                            }
  731. {    spec    input:    An FSSpec record specifying the object.                    }
  732.  
  733.  
  734. {***************************************************************************}
  735.  
  736.  
  737.     FUNCTION SetNameLocked (vRefNum: Integer;
  738.                                     dirID: LongInt;
  739.                                     name: StringPtr): OSErr;
  740. {    Use SetNameLocked to set the nameLocked bit in the fdFlags word of the    }
  741. {    specified file or directory's finder information.                        }
  742. {                                                                            }
  743. {    vRefNum    input:    Volume specification.                                    }
  744. {    dirID    input:    Directory ID.                                            }
  745. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  746. {                    a directory that's the object.                            }
  747.  
  748.  
  749. {***************************************************************************}
  750.  
  751.  
  752.     FUNCTION FSpSetNameLocked (spec: FSSpec): OSErr;
  753. {    Use FSpSetNameLocked to set the nameLocked bit in the fdFlags word of    }
  754. {    the specified file or directory's finder information.                    }
  755. {                                                                            }
  756. {    spec    input:    An FSSpec record specifying the object.                    }
  757.  
  758.  
  759. {***************************************************************************}
  760.  
  761.  
  762.     FUNCTION ClearNameLocked (vRefNum: Integer;
  763.                                     dirID: LongInt;
  764.                                     name: StringPtr): OSErr;
  765. {    Use ClearNameLocked to clear the nameLocked bit in the fdFlags word of    }
  766. {    the specified file or directory's finder information.                    }
  767. {                                                                            }
  768. {    vRefNum    input:    Volume specification.                                    }
  769. {    dirID    input:    Directory ID.                                            }
  770. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  771. {                    a directory that's the object.                            }
  772.  
  773.  
  774. {***************************************************************************}
  775.  
  776.  
  777.     FUNCTION FSpClearNameLocked (spec: FSSpec): OSErr;
  778. {    Use FSpClearNameLocked to clear the nameLocked bit in the fdFlags word    }
  779. {    of the specified file or directory's finder information.                }
  780. {                                                                            }
  781. {    spec    input:    An FSSpec record specifying the object.                    }
  782.  
  783.  
  784. {***************************************************************************}
  785.  
  786.  
  787.     FUNCTION SetIsStationery (vRefNum: Integer;
  788.                                     dirID: LongInt;
  789.                                     name: Str255): OSErr;
  790. {    Use SetIsStationery to set the isStationery bit in the fdFlags word        }
  791. {    of the specified file or directory's finder information.                }
  792. {                                                                            }
  793. {    vRefNum    input:    Volume specification.                                    }
  794. {    dirID    input:    Directory ID.                                            }
  795. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  796. {                    a directory that's the object.                            }
  797.  
  798.  
  799. {***************************************************************************}
  800.  
  801.  
  802.     FUNCTION FSpSetIsStationery (spec: FSSpec): OSErr;
  803. {    Use FSpSetIsStationery to set the isStationery bit in the fdFlags        }
  804. {    word of the specified file or directory's finder information.            }
  805. {                                                                            }
  806. {    spec    input:    An FSSpec record specifying the object.                    }
  807.  
  808.  
  809. {***************************************************************************}
  810.  
  811.  
  812.     FUNCTION ClearIsStationery (vRefNum: Integer;
  813.                                     dirID: LongInt;
  814.                                     name: Str255): OSErr;
  815. {    Use ClearIsStationery to clear the isStationery bit in the fdFlags        }
  816. {    word of the specified file or directory's finder information.            }
  817. {                                                                            }
  818. {    vRefNum    input:    Volume specification.                                    }
  819. {    dirID    input:    Directory ID.                                            }
  820. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  821. {                    a directory that's the object.                            }
  822.  
  823.  
  824. {***************************************************************************}
  825.  
  826.  
  827.     FUNCTION FSpClearIsStationery (spec: FSSpec): OSErr;
  828. {    Use FSpClearIsStationery to clear the isStationery bit in the fdFlags    }
  829. {    word of the specified file or directory's finder information.            }
  830. {                                                                            }
  831. {    spec    input:    An FSSpec record specifying the object.                    }
  832.  
  833.  
  834. {***************************************************************************}
  835.  
  836.  
  837.     FUNCTION SetHasCustomIcon (vRefNum: Integer;
  838.                                     dirID: LongInt;
  839.                                     name: StringPtr): OSErr;
  840. {    Use SetHasCustomIcon to set the hasCustomIcon bit in the fdFlags word    }
  841. {    of the specified file or directory's finder information.                }
  842. {                                                                            }
  843. {    vRefNum    input:    Volume specification.                                    }
  844. {    dirID    input:    Directory ID.                                            }
  845. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  846. {                    a directory that's the object.                            }
  847.  
  848.  
  849. {***************************************************************************}
  850.  
  851.  
  852.     FUNCTION FSpSetHasCustomIcon (spec: FSSpec): OSErr;
  853. {    Use FSpSetHasCustomIcon to set the hasCustomIcon bit in the fdFlags        }
  854. {    word of the specified file or directory's finder information.            }
  855. {                                                                            }
  856. {    spec    input:    An FSSpec record specifying the object.                    }
  857.  
  858.  
  859. {***************************************************************************}
  860.  
  861.  
  862.     FUNCTION ClearHasCustomIcon (vRefNum: Integer;
  863.                                     dirID: LongInt;
  864.                                     name: StringPtr): OSErr;
  865. {    Use ClearHasCustomIcon to clear the hasCustomIcon bit in the fdFlags    }
  866. {    word of the specified file or directory's finder information.            }
  867. {                                                                            }
  868. {    vRefNum    input:    Volume specification.                                    }
  869. {    dirID    input:    Directory ID.                                            }
  870. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  871. {                    a directory that's the object.                            }
  872.  
  873.  
  874. {***************************************************************************}
  875.  
  876.  
  877.     FUNCTION FSpClearHasCustomIcon (spec: FSSpec): OSErr;
  878. {    Use FSpClearHasCustomIcon to clear the hasCustomIcon bit in the fdFlags    }
  879. {    word of the specified file or directory's finder information.            }
  880. {                                                                            }
  881. {    spec    input:    An FSSpec record specifying the object.                    }
  882.  
  883.  
  884. {***************************************************************************}
  885.  
  886.  
  887.     FUNCTION ClearHasBeenInited (vRefNum: Integer;
  888.                                     dirID: LongInt;
  889.                                     name: StringPtr): OSErr;
  890. {    Use ClearHasBeenInited to clear the hasBeenInited bit in the fdFlags    }
  891. {    word of the specified file or directory's finder information.            }
  892. {                                                                            }
  893. {    vRefNum    input:    Volume specification.                                    }
  894. {    dirID    input:    Directory ID.                                            }
  895. {    name    input:    Pointer to object name, or nil when dirID specifies        }
  896. {                    a directory that's the object.                            }
  897.  
  898.  
  899. {***************************************************************************}
  900.  
  901.     FUNCTION FSpClearHasBeenInited (spec: FSSpec): OSErr;
  902. {    Use FSpClearHasBeenInited to clear the hasBeenInited bit in the fdFlags    }
  903. {    word of the specified file or directory's finder information.            }
  904. {                                                                            }
  905. {    spec    input:    An FSSpec record specifying the object.                    }
  906.  
  907.  
  908. {***************************************************************************}
  909.  
  910.  
  911.     FUNCTION CopyFileMgrAttributes (srcVRefNum: Integer;
  912.                                     srcDirID: LongInt;
  913.                                     srcName: StringPtr;
  914.                                     dstVRefNum: Integer;
  915.                                     dstDirID: LongInt;
  916.                                     dstName: StringPtr;
  917.                                     copyLockBit: Boolean): OSErr;
  918. {    Use CopyFileMgrAttributes to copy all File Manager attributes from the    }
  919. {    source file or directory to the destination file or directory.            }
  920. {    If copyLockBit is true, then set the locked state of the destination    }
  921. {    to match the source.                                                    }
  922. {                                                                            }
  923. {    srcVRefNum    input:    Source volume specification.                        }
  924. {    srcDirID    input:    Source directory ID.                                }
  925. {    srcName        input:    Pointer to source object name, or nil when            }
  926. {                        srcDirID specifies a directory that's the object.    }
  927. {    dstVRefNum    input:    Destination volume specification.                    }
  928. {    dstDirID    input:    Destination directory ID.                            }
  929. {    dstName        input:    Pointer to destination object name, or nil when        }
  930. {                        dstDirID specifies a directory that's the object.    }
  931. {    copyLockBit    input:    If true, set the locked state of the destination    }
  932. {                        to match the source.                                }
  933.  
  934.  
  935. {***************************************************************************}
  936.  
  937.  
  938.     FUNCTION FSpCopyFileMgrAttributes (srcSpec: FSSpec;
  939.                                     dstSpec: FSSpec;
  940.                                     copyLockBit: Boolean): OSErr;
  941. {    Use FSpCopyFileMgrAttributes to copy all File Manager attributes from    }
  942. {    the source file or directory to the destination file or directory.        }
  943. {    If copyLockBit is true, then set the locked state of the destination    }
  944. {    to match the source.                                                    }
  945. {                                                                            }
  946. {    srcSpec        input:    An FSSpec record specifying the source object.        }
  947. {    dstSpec        input:    An FSSpec record specifying the destination object.    }
  948. {    copyLockBit    input:    If true, set the locked state of the destination    }
  949. {                        to match the source.                                }
  950.  
  951.  
  952. {***************************************************************************}
  953.  
  954.  
  955.     FUNCTION HOpenAware (vRefNum: Integer;
  956.                                     dirID: LongInt;
  957.                                     fileName: Str255;
  958.                                     denyModes: Integer;
  959.                                     VAR refNum: Integer): OSErr;
  960. {    Use HOpenAware to open the data fork of a file using deny mode            }
  961. {    permissions instead the normal File Manager permissions.  If OpenDeny    }
  962. {    is not available, then HOpenAware translates the deny modes to the        }
  963. {    closest File Manager permissions and tries to open the file with        }
  964. {    OpenDF first, and then Open if OpenDF isn't available. By using            }
  965. {    HOpenAware with deny mode permissions, a program can be "AppleShare        }
  966. {    aware" and fall back on the standard File Manager open calls            }
  967. {    automatically.                                                            }
  968. {                                                                            }
  969. {    vRefNum        input:    Volume specification.                                }
  970. {    dirID        input:    Directory ID.                                        }
  971. {    fileName    input:    The name of the file.                                }
  972. {    denyModes    input:    The deny modes access under which to open the file.    }
  973. {    refNum        output:    The file reference number of the opened file.        }
  974.  
  975.  
  976. {***************************************************************************}
  977.  
  978.  
  979.     FUNCTION FSpOpenAware (spec: FSSpec;
  980.                                     denyModes: Integer;
  981.                                     VAR refNum: Integer): OSErr;
  982. {    Use FSpOpenAware to open the data fork of a file using deny mode        }
  983. {    permissions instead the normal File Manager permissions.  If OpenDeny    }
  984. {    is not available, then FSpOpenAware translates the deny modes to the    }
  985. {    closest File Manager permissions and tries to open the file with        }
  986. {    OpenDF first, and then Open if OpenDF isn't available. By using            }
  987. {    FSpOpenAware with deny mode permissions, a program can be "AppleShare    }
  988. {    aware" and fall back on the standard File Manager open calls            }
  989. {    automatically.                                                            }
  990. {                                                                            }
  991. {    spec        input:    An FSSpec record specifying the file.                }
  992. {    denyModes    input:    The deny modes access under which to open the file.    }
  993. {    refNum        output:    The file reference number of the opened file.        }
  994.  
  995.  
  996. {***************************************************************************}
  997.  
  998.  
  999.     FUNCTION HOpenRFAware (vRefNum: Integer;
  1000.                                     dirID: LongInt;
  1001.                                     fileName: Str255;
  1002.                                     denyModes: Integer;
  1003.                                     VAR refNum: Integer): OSErr;
  1004. {    Use HOpenRFAware to open the resource fork of a file using deny mode    }
  1005. {    permissions instead the normal File Manager permissions.  If OpenRFDeny    }
  1006. {    is not available, then HOpenRFAware translates the deny modes to the    }
  1007. {    closest File Manager permissions and tries to open the file with        }
  1008. {    OpenRF. By using HOpenRFAware with deny mode permissions, a program        }
  1009. {    can be "AppleShare aware" and fall back on the standard File Manager    }
  1010. {    open calls automatically.                                                }
  1011. {                                                                            }
  1012. {    vRefNum        input:    Volume specification.                                }
  1013. {    dirID        input:    Directory ID.                                        }
  1014. {    fileName    input:    The name of the file.                                }
  1015. {    denyModes    input:    The deny modes access under which to open the file.    }
  1016. {    refNum        output:    The file reference number of the opened file.        }
  1017.  
  1018.  
  1019. {***************************************************************************}
  1020.  
  1021.  
  1022.     FUNCTION FSpOpenRFAware (spec: FSSpec;
  1023.                                     denyModes: Integer;
  1024.                                     VAR refNum: Integer): OSErr;
  1025. {    Use FSpOpenRFAware to open the resource fork of a file using deny mode    }
  1026. {    permissions instead the normal File Manager permissions.  If OpenRFDeny    }
  1027. {    is not available, then FSpOpenRFAware translates the deny modes to the    }
  1028. {    closest File Manager permissions and tries to open the file with        }
  1029. {    OpenRF. By using FSpOpenRFAware with deny mode permissions, a program    }
  1030. {    can be "AppleShare aware" and fall back on the standard File Manager    }
  1031. {    open calls automatically.                                                }
  1032. {                                                                            }
  1033. {    spec        input:    An FSSpec record specifying the file.                }
  1034. {    denyModes    input:    The deny modes access under which to open the file.    }
  1035. {    refNum        output:    The file reference number of the opened file.        }
  1036.  
  1037.  
  1038. {***************************************************************************}
  1039.  
  1040.  
  1041.     FUNCTION FSReadNoCache (refNum: Integer;
  1042.                                     VAR count: LongInt;
  1043.                                     buffPtr: Ptr): OSErr;
  1044. {    Use FSReadNoCache to read any number of bytes from an open file while    }
  1045. {    asking the file system to bypass its cache mechanism.                    }
  1046. {                                                                            }
  1047. {    refNum    input:    The file reference number of an open file.                }
  1048. {    count    input:    The number of bytes to read.                            }
  1049. {            output:    The number of bytes actually read.                        }
  1050. {    buffPtr    input:    A pointer to the data buffer into which the bytes are    }
  1051. {                    to be read.                                                }
  1052.  
  1053.  
  1054. {***************************************************************************}
  1055.  
  1056.  
  1057.     FUNCTION FSWriteNoCache (refNum: Integer;
  1058.                                     VAR count: LongInt;
  1059.                                     buffPtr: Ptr): OSErr;
  1060. {    Use FSReadNoCache to write any number of bytes to an open file while    }
  1061. {    asking the file system to bypass its cache mechanism.                    }
  1062. {                                                                            }
  1063. {    refNum    input:    The file reference number of an open file.                }
  1064. {    count    input:    The number of bytes to write to the file.                }
  1065. {            output:    The number of bytes actually written.                    }
  1066. {    buffPtr    input:    A pointer to the data buffer from which the bytes are    }
  1067. {                    to be written.                                            }
  1068.  
  1069.  
  1070. {***************************************************************************}
  1071.  
  1072.  
  1073.     FUNCTION CopyFork (srcRefNum: Integer;
  1074.                                     dstRefNum: Integer;
  1075.                                     copyBufferPtr: Ptr;
  1076.                                     copyBufferSize: LongInt): OSErr;
  1077. {    Use CopyFork to copy all data from the source fork to the destination    }
  1078. {    fork of open file forks and makes sure the destination EOF is equal        }
  1079. {    to the source EOF.                                                        }
  1080. {                                                                            }
  1081. {    srcRefNum        input:    The source file reference number.                }
  1082. {    dstRefNum        input:    The destination file reference number.            }
  1083. {    copyBufferPtr    input:    Pointer to buffer to use during copy. The        }
  1084. {                            buffer should be at least 512-bytes minimum.    }
  1085. {                            The larger the buffer, the faster the copy.        }
  1086. {    copyBufferSize    input:    The size of the copy buffer.                    }
  1087.  
  1088.  
  1089. {***************************************************************************}
  1090.  
  1091.  
  1092.     FUNCTION GetFileLocation (refNum: Integer;
  1093.                                     VAR vRefNum: Integer;
  1094.                                     VAR dirID: LongInt;
  1095.                                     fileName: StringPtr): OSErr;
  1096. {    Use GetFileLocation to get the location (volume reference number,        }
  1097. {    directory ID, and fileName) of an open file.                            }
  1098. {                                                                            }
  1099. {    refNum        input:    The file reference number of an open file.            }
  1100. {    vRefNum        output:    The volume reference number.                        }
  1101. {    dirID        output:    The parent directory ID.                            }
  1102. {    fileName    input:    Points to a buffer (minimum Str63) where the        }
  1103. {                        filename is to be returned or must be nil.            }
  1104. {                output:    The filename.                                        }
  1105.  
  1106.  
  1107. {***************************************************************************}
  1108.  
  1109.  
  1110.     FUNCTION FSpGetFileLocation (refNum: Integer;
  1111.                                     VAR spec: FSSpec): OSErr;
  1112. {    Use FSpGetFileLocation to get the location of an open file in an        }
  1113. {    FSSpec record.                                                            }
  1114. {                                                                            }
  1115. {    refNum        input:    The file reference number of an open file.            }
  1116. {    spec        output:    FSSpec record containing the file name and location.}
  1117.  
  1118.  
  1119. {***************************************************************************}
  1120.  
  1121.  
  1122.     FUNCTION CopyDirectoryAccess (srcVRefNum: Integer;
  1123.                                     srcDirID: LongInt;
  1124.                                     srcName: StringPtr;
  1125.                                     dstVRefNum: Integer;
  1126.                                     dstDirID: LongInt;
  1127.                                     dstName: StringPtr): OSErr;
  1128. {    Use CopyDirectoryAccess to copy the AFP directory access privileges        }
  1129. {    from one directory to another. Both directories must be on the same        }
  1130. {    file server, but not necessarily on the same server volume.                }
  1131. {                                                                            }
  1132. {    srcVRefNum    input:    Source volume specification.                        }
  1133. {    srcDirID    input:    Source directory ID.                                }
  1134. {    srcName        input:    Pointer to source directory name, or nil when        }
  1135. {                        srcDirID specifies the directory.                    }
  1136. {    dstVRefNum    input:    Destination volume specification.                    }
  1137. {    dstDirID    input:    Destination directory ID.                            }
  1138. {    dstName        input:    Pointer to destination directory name, or nil when    }
  1139. {                        dstDirID specifies the directory.                    }
  1140.  
  1141.  
  1142. {***************************************************************************}
  1143.  
  1144.  
  1145.     FUNCTION FSpCopyDirectoryAccess (srcSpec: FSSpec;
  1146.                                     dstSpec: FSSpec): OSErr;
  1147. {    Use FSpCopyDirectoryAccess to copy the AFP directory access privileges    }
  1148. {    from one directory to another. Both directories must be on the same        }
  1149. {    file server, but not necessarily on the same server volume.                }
  1150. {                                                                            }
  1151. {    srcSpec        input:    An FSSpec record specifying the source directory.    }
  1152. {    dstSpec        input:    An FSSpec record specifying the destination            }
  1153. {                        directory.                                            }
  1154.  
  1155.  
  1156. {***************************************************************************}
  1157.  
  1158.  
  1159.     FUNCTION HMoveRenameCompat (vRefNum: Integer;
  1160.                                     srcDirID: LongInt;
  1161.                                     srcName: Str255;
  1162.                                     dstDirID: LongInt;
  1163.                                     dstpathName: StringPtr;
  1164.                                     copyName: StringPtr): OSErr;
  1165. {    Use HMoveRenameCompat to move a file or directory and optionally to        }
  1166. {    rename it.  The source and destination locations must be on the same    }
  1167. {    volume. This routine works even if the volume doesn't support            }
  1168. {    MoveRename.                                                                }
  1169. {                                                                            }
  1170. {    vRefNum        input:    Volume specification.                                }
  1171. {    srcDirID    input:    Source directory ID.                                }
  1172. {    srcName        input:    The source object name.                                }
  1173. {    dstDirID    input:    Destination directory ID.                            }
  1174. {    dstName        input:    Pointer to destination directory name, or            }
  1175. {                        nil when dstDirID specifies a directory.            }
  1176. {    copyName    input:    Points to the new name if the object is to be        }
  1177. {                        renamed or nil if the object isn't to be renamed.    }
  1178.  
  1179.  
  1180.  
  1181. {***************************************************************************}
  1182.  
  1183.  
  1184.     FUNCTION FSpMoveRenameCompat (srcSpec: FSSpec;
  1185.                                     dstSpec: FSSpec;
  1186.                                     copyName: StringPtr): OSErr;
  1187. {    Use FSpMoveRenameCompat to move a file or directory and optionally to    }
  1188. {    rename it. The source and destination locations must be on the same        }
  1189. {    volume. This routine works even if the volume doesn't support            }
  1190. {    MoveRename.                                                                }
  1191. {                                                                            }
  1192. {    srcSpec        input:    An FSSpec record specifying the source object.        }
  1193. {    dstSpec        input:    An FSSpec record specifying the destination            }
  1194. {                        directory.                                            }
  1195. {    copyName    input:    Points to the new name if the object is to be        }
  1196. {                        renamed or nil if the object isn't to be renamed.    }
  1197.  
  1198.  
  1199. {***************************************************************************}
  1200.  
  1201.  
  1202.     FUNCTION BuildAFPVolMountInfo (theFlags: Integer;
  1203.                                     theNBPInterval: SignedByte;
  1204.                                     theNBPCount: SignedByte;
  1205.                                     theUAMType: Integer;
  1206.                                     theZoneName: Str31;
  1207.                                     theServerName: Str31;
  1208.                                     theVolName: Str27;
  1209.                                     theUserName: Str31;
  1210.                                     theUserPassWord: Str8;
  1211.                                     theVolPassWord: Str8;
  1212.                                     theAFPInfo: MyAFPVolMountInfoPtr): OSErr;
  1213. {    Use BuildAFPVolMountInfo to initialize the fields of an AFPVolMountInfo    }
  1214. {    record before using that record to call the VolumeMount function.        }
  1215. {                                                                            }
  1216. {    theFlags        input:    The AFP mounting flags. 0 = normal mount;        }
  1217. {                            set bit 0 to inhibit greeting messages.            }
  1218. {    theNBPInterval    input:    The interval used for VolumeMount's                }
  1219. {                            NBP Lookup call. 7 is a good choice.            }
  1220. {    theNBPCount        input:    The retry count used for VolumeMount's            }
  1221. {                            NBP Lookup call. 5 is a good choice.            }
  1222. {    theUAMType        input:    The user authentication method to use.            }
  1223. {    theZoneName        input:    The AppleTalk zone name of the server.            }
  1224. {    theServerName    input:    The AFP server name.                            }
  1225. {    theVolName        input:    The AFP volume name.                            }
  1226. {    theUserName        input:    The user name (zero length Pascal string for    }
  1227. {                            guest).                                            }
  1228. {    theUserPassWord    input:    The user password (zero length Pascal string    }
  1229. {                            if no user password)                            }
  1230. {    theVolPassWord    input:    The volume password (zero length Pascal string    }
  1231. {                            if no volume password)                            }
  1232. {    theAFPInfo        input:    Pointer to AFPVolMountInfo record to            }
  1233. {                            initialize.                                        }
  1234.  
  1235.  
  1236. {***************************************************************************}
  1237.  
  1238.  
  1239.     FUNCTION RetrieveAFPVolMountInfo (theAFPInfo: AFPVolMountInfoPtr;
  1240.                                     VAR theFlags: Integer;
  1241.                                     VAR theUAMType: Integer;
  1242.                                     theZoneName: StringPtr;
  1243.                                     theServerName: StringPtr;
  1244.                                     theVolName: StringPtr;
  1245.                                     theUserName: StringPtr): OSErr;
  1246. {    Use RetrieveAFPVolMountInfo to retrieve the AFP mounting information    }
  1247. {    returned in an AFPVolMountInfo by the GetVolMountInfo function.            }
  1248. {                                                                            }
  1249. {    theAFPInfo        input:    Pointer to AFPVolMountInfo record that contains    }
  1250. {                            the AFP mounting information.                    }
  1251. {    theFlags        output:    The AFP mounting flags. 0 = normal mount;        }
  1252. {                            if bit 0 is set, greeting meesages were            }
  1253. {                            inhibited.                                        }
  1254. {    theUAMType        output:    The user authentication method used.            }
  1255. {    theZoneName        output:    The AppleTalk zone name of the server.            }
  1256. {    theServerName    output:    The AFP server name.                            }
  1257. {    theVolName        output:    The AFP volume name.                            }
  1258. {    theUserName        output:    The user name (zero length Pascal string for    }
  1259. {                            guest).                                            }
  1260.  
  1261.  
  1262. {***************************************************************************}
  1263.  
  1264.  
  1265.     FUNCTION GetUGEntries (objType: Integer;
  1266.                                     entries: UGEntryPtr;
  1267.                                     reqEntryCount: LongInt;
  1268.                                     VAR actEntryCount: LongInt;
  1269.                                     VAR objID: LongInt): OSErr;
  1270. {    Use GetUGEntries to build a list of user or group entries from the        }
  1271. {    local file server.                                                        }
  1272. {                                                                            }
  1273. {    objType            input:    The object type: -1 = group; 0 = user            }
  1274. {    UGEntries        input:    Pointer to array of UGEntry records where the    }
  1275. {                            list is returned.                                }
  1276. {    reqEntryCount    input:    The number of elements in the UGEntries array.    }
  1277. {    actEntryCount    output:    The number of entries returned.                    }
  1278. {    objID            input:    The current index position. Set to 0 to start    }
  1279. {                            with the first entry.                            }
  1280. {                    output:    The index position to get the next entry. Pass    }
  1281. {                            this value the next time you call GetUGEntries    }
  1282. {                            to start where you left off.                    }
  1283.  
  1284.  
  1285. {***************************************************************************}
  1286.  
  1287.  
  1288. IMPLEMENTATION
  1289.  
  1290. {    Functions to get information out of GetVolParmsInfoBuffer.                }
  1291.  
  1292.  
  1293.     FUNCTION isNetworkVolume (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1294.     BEGIN
  1295.         isNetworkVolume := (volParms.vMServerAdr <> 0);
  1296.     END;
  1297.  
  1298.     FUNCTION hasLimitFCBs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1299.     BEGIN
  1300.         hasLimitFCBs := BTST(volParms.vMAttrib, bLimitFCBs);
  1301.     END;
  1302.  
  1303.     FUNCTION hasLocalWList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1304.     BEGIN
  1305.         hasLocalWList := BTST(volParms.vMAttrib, bLocalWList);
  1306.     END;
  1307.  
  1308.     FUNCTION hasNoMiniFndr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1309.     BEGIN
  1310.         hasNoMiniFndr := BTST(volParms.vMAttrib, bNoMiniFndr);
  1311.     END;
  1312.  
  1313.     FUNCTION hasNoVNEdit (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1314.     BEGIN
  1315.         hasNoVNEdit := BTST(volParms.vMAttrib, bNoVNEdit);
  1316.     END;
  1317.  
  1318.     FUNCTION hasNoLclSync (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1319.     BEGIN
  1320.         hasNoLclSync := BTST(volParms.vMAttrib, bNoLclSync);
  1321.     END;
  1322.  
  1323.     FUNCTION hasTrshOffLine (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1324.     BEGIN
  1325.         hasTrshOffLine := BTST(volParms.vMAttrib, bTrshOffLine);
  1326.     END;
  1327.  
  1328.     FUNCTION hasNoSwitchTo (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1329.     BEGIN
  1330.         hasNoSwitchTo := BTST(volParms.vMAttrib, bNoSwitchTo);
  1331.     END;
  1332.  
  1333.     FUNCTION hasNoDeskItems (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1334.     BEGIN
  1335.         hasNoDeskItems := BTST(volParms.vMAttrib, bNoDeskItems);
  1336.     END;
  1337.  
  1338.     FUNCTION hasNoBootBlks (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1339.     BEGIN
  1340.         hasNoBootBlks := BTST(volParms.vMAttrib, bNoBootBlks);
  1341.     END;
  1342.  
  1343.     FUNCTION hasAccessCntl (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1344.     BEGIN
  1345.         hasAccessCntl := BTST(volParms.vMAttrib, bAccessCntl);
  1346.     END;
  1347.  
  1348.     FUNCTION hasNoSysDir (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1349.     BEGIN
  1350.         hasNoSysDir := BTST(volParms.vMAttrib, bNoSysDir);
  1351.     END;
  1352.  
  1353.     FUNCTION hasExtFSVol (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1354.     BEGIN
  1355.         hasExtFSVol := BTST(volParms.vMAttrib, bHasExtFSVol);
  1356.     END;
  1357.  
  1358.     FUNCTION hasOpenDeny (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1359.     BEGIN
  1360.         hasOpenDeny := BTST(volParms.vMAttrib, bHasOpenDeny);
  1361.     END;
  1362.  
  1363.     FUNCTION hasCopyFile (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1364.     BEGIN
  1365.         hasCopyFile := BTST(volParms.vMAttrib, bHasCopyFile);
  1366.     END;
  1367.  
  1368.     FUNCTION hasMoveRename (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1369.     BEGIN
  1370.         hasMoveRename := BTST(volParms.vMAttrib, bHasMoveRename);
  1371.     END;
  1372.  
  1373.     FUNCTION hasDesktopMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1374.     BEGIN
  1375.         hasDesktopMgr := BTST(volParms.vMAttrib, bHasDesktopMgr);
  1376.     END;
  1377.  
  1378.     FUNCTION hasShortName (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1379.     BEGIN
  1380.         hasShortName := BTST(volParms.vMAttrib, bHasShortName);
  1381.     END;
  1382.  
  1383.     FUNCTION hasFolderLock (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1384.     BEGIN
  1385.         hasFolderLock := BTST(volParms.vMAttrib, bHasFolderLock);
  1386.     END;
  1387.  
  1388.     FUNCTION hasPersonalAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1389.     BEGIN
  1390.         hasPersonalAccessPrivileges := BTST(volParms.vMAttrib, bHasPersonalAccessPrivileges);
  1391.     END;
  1392.  
  1393.     FUNCTION hasUserGroupList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1394.     BEGIN
  1395.         hasUserGroupList := BTST(volParms.vMAttrib, bHasUserGroupList);
  1396.     END;
  1397.  
  1398.     FUNCTION hasCatSearch (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1399.     BEGIN
  1400.         hasCatSearch := BTST(volParms.vMAttrib, bHasCatSearch);
  1401.     END;
  1402.  
  1403.     FUNCTION hasFileIDs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1404.     BEGIN
  1405.         hasFileIDs := BTST(volParms.vMAttrib, bHasFileIDs);
  1406.     END;
  1407.  
  1408.     FUNCTION hasBTreeMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1409.     BEGIN
  1410.         hasBTreeMgr := BTST(volParms.vMAttrib, bHasBTreeMgr);
  1411.     END;
  1412.  
  1413.     FUNCTION hasBlankAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
  1414.     BEGIN
  1415.         hasBlankAccessPrivileges := BTST(volParms.vMAttrib, bHasBlankAccessPrivileges);
  1416.     END;
  1417.  
  1418. END.